<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body></body>
<script>
    new Promise(function (resolve, reject){
        setTimeout((flag)=>{
            if(flag){
                resolve("第一次请求成功")
            }else {
                reject("第一次请求失败")
            }
        },2000,true)
    }).then(()=>{
        return new Promise((resolve, reject)=>{
            setTimeout((flag)=>{
                if(flag){
                    resolve("第二次请求成功")
                }else {
                    reject("第二次请求失败")
                }
            },2000,false)
        })
    }).then(()=>{
        return new Promise((resolve, reject)=>{
            setTimeout((flag)=>{
                if(flag){
                    resolve("第三次请求成功")
                }else {
                    reject("第三次请求失败")
                }
            },2000,true)
        })
    }).catch((err)=>{
        console.log(err);
    })
</script>
</html>